Oa.controller('meetingCtrl',function($scope,$http){
	
	$('#calendar').fullCalendar({
	    header: {
	        right: 'month,agendaWeek,agendaDay prev,next',
	        left: 'title'
	    },
	    editable: true,
	    buttonText: {
	        prev: '<i class="fa fa-chevron-left"></i>',
	        next: '<i class="fa fa-chevron-right"></i>',
	        today: 'Today',
	        month: 'Month',
	        week: 'Week',
	        day: 'Day'
	    },
	    droppable: true,
	    drop: function (date, allDay) {
	
	        var originalEventObject = $(this).data('eventObject');
	
	        var copiedEventObject = $.extend({}, originalEventObject);
	
	        copiedEventObject.start = date;
	        copiedEventObject.allDay = allDay;
	
	        $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
	
	        if ($('#drop-remove').is(':checked')) {
	            $(this).remove();
	        }
	
	    },
	   	dayClick: function(date, allDay, jsEvent, view) {
			console.log(view);
			//
		},
		eventClick: function(event, jsEvent, view) {
			console.log(event);
			//chuli 
		},
	   	events:function(start,end,callback){
	    	$http.get(getMeetingURL)
	    	.success(function(res){
	    		console.log(res);
	    		var meetings = res.events;
	    		var events = [];
	    		for(var i=0;i<meetings.length;i++){
	    			events.push({
	    				title:meetings[i].title,
	    				start:new Date(meetings[i].start),
	    				end:new Date(meetings[i].end)
	    			})
	    		}
	    		callback(events);
	    	})
	    	.error(function(){
	    		
	    	});
	    	
	    }
	    
	});
});
	